package cn.net.xyan.easy.spring.utils;

import cn.net.xyan.easy.spring.model.RestServiceModule;

import javax.annotation.processing.ProcessingEnvironment;
import javax.tools.FileObject;
import java.io.IOException;

/**
 * Created by zarra on 16/3/8.
 */
public class FileObjectUtils {
    public static FileObject fileObject(String fullTypeName,ProcessingEnvironment env) throws IOException {
        return env.getFiler().createSourceFile(fullTypeName);
    }

    public static FileObject fileObject(RestServiceModule module, ProcessingEnvironment env) throws IOException {
        return fileObject(
                String.format("%s.%s", module.getPackageName(), module.getTypeName()),env);
    }
}
